Allow reference links with backticks (again)#1582
Allow reference links with backticks (again)#1582martynp wants to merge 1 commit intoPython-Markdown:masterfrom
Conversation
2bd2040 to
99dc4f7
Compare
99dc4f7 to
f0487a0
Compare
|
I haven't looked too closely at this yet, but I'll go ahead and give some of my general thoughts.
There are probably ways to do this generally, but it would had a bit of code complexity to maintain. Maybe, assuming the reference extension is registered:
Now I haven't really ever prototyped this, and I'm not sure of all the pitfalls that could be involved. To be honest, this would work best if Python Markdown processed the content into an AST first. This is how most modern parsers achieve what you are after. All context is available before the rendering step. Python Markdown, on the other hand, is parsing and rendering along the way, losing context at times in future steps. A big rewrite of Python Markdown is likely never going to happen. |
|
Fair enough, was hoping for some consistency with normal links. Will just pre-process references with backticks with find & replace approach. There was a PR to fix this in in php-markdown but I cant seem to find it any more - although the 1.x branch is not getting updates. I believe it is fixed in the 2.x branch, so I assume this lib will stick with the 1.x implementation. |
|
Again, these are just my general opinions. @waylan has the final say. I never use anything but normal, simple identifiers for references, even when using parsers that could parse code blocks as references. I'm also not against having support for code blocks as references. My personal preference would be that it was general enough to support most anything, rather than hard-coding a solution. @waylan may be fine with the direction. I think it is likely possible to pull off something general enough, and that works well enough to be suitable. I question how much it is worth the effort, but I'm not against it per se. I realize that there may always be some corner cases where this doesn't work, but if it were "good enough", and "general enough", I think it would be fine.
I don't know, its architecture is different and their goals of what they want in the future may be different than ours. That's at least where Python Markdown started, using PHP Markdown as the reference. |
@facelessuser
Thoughts appreciated - I did have this working on a previous version, but seem to have dropped the test and broke it in the re-write. Thought it was a bit too simple.
Previously I was expanding the backtick within reference, then comparing against the stashed nodes.
So find reference and expand to [some
content] then storing that as the references list.Then in the inline reference processor, all of the stashed_nodes were expanded and then the reference comparison happens.